
import { initGlobalState } from 'qiankun'

const initialState = {
  username: null,
  email: null,
  cake: null
}

const actions = initGlobalState(initialState);

actions.onGlobalStateChange((state, prev) => {
  for (const key in state) {
    initialState[key] = state[key]
  }
})

actions.getGlobalState = (key) => {
	return key ? initialState[key] : initialState
}

export default actions